.\"-
.\" Copyright (c) 2013 SRI International
.\" All rights reserved.
.\"
.\" This software was developed by SRI International and the University of
.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
.\" ("CTSRD"), as part of the DARPA CRASH research programme.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.Dd May 20, 2013
.Dt MAKEROOT 8
.Os
.Sh NAME
.Nm makeroot
.Nd Tool to create root filesystem images given a tree containing a manifest
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl B Ar byte-order
.Op Fl e Ar extras-manifest
.Op Fl f Ar filelist
.Op Fl k Ar keydir Op Fl K Ar user
.Op Fl l Ar label
.Op Fl p Ar master.passwd Op Fl g Ar group
.Op Fl s Ar size
.Ar image-file
.Ar rootdir
.Sh DESCRIPTION
The
.Nm
script creates a UFS filesystem image into
.Ar imagefile .
By default,
all filesystem objects listed in the
.Pa METALOG
file contained in the
.Ar rootdir
directory will be placed in the root of the UFS image
.Ar image-file .
.Pp
Images can be customized with a number of different flags:
.Bl -tag -width indent
.It Fl B Ar byte-order
Set the byte order of the image to
.Ar byte-order .
This argument is passed directly to
.Xr makefs 8 .
.It Fl d
Enable debugging output.
.It Fl e Ar manifest
Extra files listed in the
.Xr nmtree 8
format
.Ar manifest
file are added to the filesystem image.
If no contents= tag is specified or a contents= tag is relative then
files are found relative to the basename of the full path of the
manifest.
If a contents= tag is provided and it is an absolute path then the file
will be from that path.
.It Fl f Ar filelist
Constrain set of filesystem objects included from
.Ar rootdir
to those listed (one per line) in the
.Ar filelist
plus any required directories.
.It Fl k Ar keydir Op Fl K Ar user
Create a .ssh/authorized_keys file from a collection of public key files
stored in
.Ar keydir
and install it in the home directory of
.Ar user .
If no
.Fl K
argument is supplied then the files will be installed in the root user's
directory.
.It Fl l Ar label
Set the file system volume label.
.It Fl p Ar master.passwd Op Fl g Ar group
Install an alternate
.Ar master.passwd
file and optionally an alternative
.Ar group
file.
.It Fl s Ar size
Set the size of the image to
.Ar size .
The
.Fl s
argument is passed directly to
.Xr makefs 8 .
.El
.Sh FILES
.Bl -tag -width METALOG -compact
.It Pa METALOG
.Xr mtree 5
2.0 format manifest of permissions and ownership for files in the root
directory.
This file is generated by installworld, distribution, and installkernel.
.El
.Sh EXAMPLES
.Dl $ makeroot.sh -k keys -K ctsrd -p extras/etc/master.passwd -g extras/etc/group -e extras/mdroot.mtree -e demo/demo.mtree -e extras/ctsrd.mtree -s 26112k -f demo.files cheribsd-demo.img /path/to/dist
.Sh SEE ALSO
.Xr mtree 5 ,
.Xr makefs 8 ,
.Xr nmtree 8
.Sh AUTHORS
This software and this manual page were developed by SRI International
and the University of Cambridge Computer Laboratory under DARPA/AFRL
contract
.Pq FA8750-10-C-0237
.Pq Do CTSRD Dc ,
as part of the DARPA CRASH research programme.
